package logic

import (
	"context"
	"errors"
	"product_server/dao/dao_redis"
	product "product_server/proto"
)

// CarList 购物车列表展示
func (p *ProductServer) CarList(ctx context.Context, req *product.CarListRequest) (*product.CarListResponse, error) {
	list, err := dao_redis.CarList(req.Uid)
	if err != nil {
		return nil, err
	}
	if list == nil {
		return nil, errors.New("购物车查询失败")
	}
	return &product.CarListResponse{List: list}, nil
}
